<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="fm">
						<input id="recordId" name="recordId" th:value="${record.recordId}"
							type="hidden">
						<div class="form-group">
							<label class="col-sm-3 control-label">红包名称：</label>
							<div class="col-sm-8">
								<input id="redName" name="redName" class="form-control"
									type="text" th:value="${record.redName}" readonly>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">红包面额：</label>
							<div class="col-sm-8">
								<input id="amount" name="amount" class="form-control" type="text"
									th:value="${record.amount}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">状态:</label>
							<div class="col-sm-8">
								<label class="radio-inline"> <input type="radio"
									name="state" value="0" th:field="*{record.state}"/>未使用
								</label> <label class="radio-inline"> <input type="radio"
									name="state" value="1" th:field="*{record.state}"/>已使用
								</label>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-8 col-sm-offset-3">
								<button type="button" onclick="update()" class="btn btn-primary">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript">
function update() {
	$.ajax({
		cache : true,
		type : "POST",
		url : "/partner/userRed/updateUserRed",
		data : $('#fm').serialize(),// 你的formid
		async : false,
		error : function(request) {
			alert("Connection error");
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg(data.msg);
				parent.reLoad();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
			} else {
				parent.layer.msg(data.msg);
			}

		}
	});

}
	</script>
</body>
</html>
